<?php
	require_once( '../system/mdao/Class_M_OTHER.php' );
	require_once( '../system/smarty.inc' );
	require_once( '../system/aoki_m.php' );
	$v = NULL;
	$para = "";
	if( isset($_GET['t']) && $_GET['t'] != '' ){
		$para =  $_GET['t'];
		if( isset($_GET['v']) && $_GET['v'] != '' ){
			$value = lTrim(rTrim( urldecode($_GET['v'])  ))  ;
		}
		
	}else{
		echo "検索エラー";
		exit;
	}
	
	$page = array();
	if( isset( $_GET['page'] ) && is_numeric( $_GET['page'] ) ){		
		$page['current'] = $_GET['page'];	
	}else{
		$page['current'] = 1;
	}
	$idflg = 2;
	switch ($para) {
		case "media":
			$data = Class_M_OTHER::get_media($value, $page);
			break;
		case "mediaid":
		case "smediaid":

			$data = Class_M_OTHER::get_media($value, $page);
			$idflg = 1;
			break;
		case "area":
			$data = Class_M_OTHER::get_area($value, $page);
			break;
		case "publish_area":
			$data = Class_M_OTHER::get_publish_area($value, $page);
			break;
		case "hand":
			$data = Class_M_OTHER::get_hand($value, $page);
			break;
		case "handid":
			$data = Class_M_OTHER::get_hand($value, $page);
			$idflg = 1;
			break;
		case "delive":
		    $ins =  $_GET['ins'];		  
		   	$data = Class_M_OTHER::get_delive($value, $page,NULL,$ins);
			
			$idflg = 1;
			break;
		case "zone":
			$data = Class_M_OTHER::get_zone($value, $page);
			break;
		case "lnews_1":
		case "lnews_2":
		case "lnews_3":
		case "lnews_4":
		case "lnews_5":
			$data = Class_M_OTHER::get_pattern($value, $page,23);
			$idflg = 1;
			break;
		case "pattern":
			$data = Class_M_OTHER::get_pattern($value, $page);
			break;
		case "dist":
			$data = Class_M_OTHER::get_dist($value, $page);
			break;
			
		 default:
            $err = "パラメタ―エラー".$para;
            echo $err;
            exit;
            break;
		
	}

	$smarty->assign('data',  $data);
	$smarty->assign('paraname', $para );
	
	$smarty->assign('idflg',  $idflg );
	
	$smarty->assign('nameval',$value );
	if( isset($page) )  $smarty->assign('page', $page);
	if ($page['cnt']>0) {
		$smarty->assign( 'pageing', $smarty->fetch('page_search.html') );
	} else {
		$smarty->assign( 'pageing', "情報は見つかりませんでした" );
	}
	
	$smarty->display('msearch_simple.html');
	
	
?>
